package cn.kailangtu.dataspot.data.context;

import android.graphics.Color;
import android.util.Log;
import android.widget.TextView;

public class MainContext {
    private static TextView selectedView;
    private static int normalColor;
    //public static boolean canOperation= false;
    public static boolean canClick = false;
    public static boolean canMove = false;

    public static TextView getSelectedView() {
        return selectedView;
    }

    public static void setSelectedView(TextView newView) {

        if (selectedView != null) {
            canClick = false;
            canMove = false;
            selectedView.setTextColor(normalColor);
        }
        if (newView != null) {
            normalColor = newView.getCurrentTextColor();
            selectedView = newView;
            canMove = true;
            canClick = true;
            newView.setTextColor(Color.parseColor("#FF0000"));
        }
    }

    public static void entry() {
        if (selectedView != null) {
            selectedView.callOnClick();
        }
    }

    public static void reset()
    {
        canClick = false;
        canMove = false;
        setSelectedView(null);
    }
}
